MAXHP_LIMIT = 99999999
STR_LIMIT = 999999
DEX_LIMIT = 999999

# 对actor类的修改
class Game_Actor < Game_Battler
  # 修改maxhp方法
  def maxhp
  	n = [[base_maxhp + @maxhp_plus, 1].max, MAXHP_LIMIT].min
    for i in @states
      n *= $data_states[i].maxhp_rate / 100.0
    end
    n = [[Integer(n), 1].max, MAXHP_LIMIT].min
    return n
  end
  # 修改base_str方法
  def base_str
    n = $data_actors[@actor_id].parameters[2, @level]
    weapon = $data_weapons[@weapon_id]
    armor1 = $data_armors[@armor1_id]
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    n += weapon != nil ? weapon.str_plus : 0
    n += armor1 != nil ? armor1.str_plus : 0
    n += armor2 != nil ? armor2.str_plus : 0
    n += armor3 != nil ? armor3.str_plus : 0
    n += armor4 != nil ? armor4.str_plus : 0
    return [[n, 1].max, STR_LIMIT].min
  end
  # 修改base_dex方法
  def base_dex
    n = $data_actors[@actor_id].parameters[3, @level]
    weapon = $data_weapons[@weapon_id]
    armor1 = $data_armors[@armor1_id]
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    n += weapon != nil ? weapon.dex_plus : 0
    n += armor1 != nil ? armor1.dex_plus : 0
    n += armor2 != nil ? armor2.dex_plus : 0
    n += armor3 != nil ? armor3.dex_plus : 0
    n += armor4 != nil ? armor4.dex_plus : 0
    return [[n, 1].max, DEX_LIMIT].min
  end
  # 修改exp=方法
  def exp=(exp)
    @exp = [[exp, 9999999].min, 0].max
  end
end

# 修改battler类
class Game_Battler
  # 修改str方法
  def str
    n = [[base_str + @str_plus, 1].max, STR_LIMIT].min
    for i in @states
      n *= $data_states[i].str_rate / 100.0
    end
    n = [[Integer(n), 1].max, STR_LIMIT].min
    return n
  end
  # 修改dex方法
  def dex
    n = [[base_dex + @dex_plus, 1].max, DEX_LIMIT].min
    for i in @states
      n *= $data_states[i].dex_rate / 100.0
    end
    n = [[Integer(n), 1].max, DEX_LIMIT].min
    return n
  end
  # 修改maxhp=方法
  def maxhp=(maxhp)
    @maxhp_plus += maxhp - self.maxhp
    @maxhp_plus = [[@maxhp_plus, -MAXHP_LIMIT].max, MAXHP_LIMIT].min
    @hp = [@hp, self.maxhp].min
  end
  # 修改str=方法
  def str=(str)
    @str_plus += str - self.str
    @str_plus = [[@str_plus, -STR_LIMIT].max, STR_LIMIT].min
  end
  # 修改dex=方法
  def dex=(dex)
    @dex_plus += dex - self.dex
    @dex_plus = [[@dex_plus, -DEX_LIMIT].max, DEX_LIMIT].min
  end
end

# 对标题画面类的修改
class Scene_Title
  # 修改按下“新游戏”按钮的动作
  alias command_new_game_old_1 command_new_game
  def command_new_game
    command_new_game_old_1
    $game_party.actors[0].maxhp = MAXHP_LIMIT
  end
end
